summaryrefslogtreecommitdiff
path: root/src/routes/posts/[slug]/+page.svelte
blob: 2a5716867862c0ca5609b19e9ee27d09fa462e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<script lang="ts">
	import type { PageData } from "./$types";
	import Giscus from "$lib/components/Giscus.svelte";

	let { data }: { data: PageData } = $props();

	function formatDate(dateStr: string): string {
		return new Date(dateStr).toLocaleDateString("en-US", {
			year: "numeric",
			month: "long",
			day: "numeric",
		});
	}
</script>

<svelte:head>
	<title>{data.metadata.title} | My Blog</title>
	<meta name="description" content={data.metadata.description} />
</svelte:head>

<article>
	<header>
		<h1>{data.metadata.title}</h1>
		<p>
			<time datetime={data.metadata.date}
				>{formatDate(data.metadata.date)}</time
			>
		</p>
	</header>

	<data.content />
</article>

<Giscus />

<a href="/">← Back to all posts</a>